package net.wofly.sale.commodity.validator;

import org.springframework.util.StringUtils;

import net.wofly.sale.commodity.domain.Brand;

public class BrandValidator {
	
	 /**
     * 换行符
     */
    private static String lineSeparator = System.getProperty("line.separator");
    
    public static String validateAddBrandParams(Brand brand) {
    		StringBuffer stringBuffer = new StringBuffer();
    		
    		if (StringUtils.isEmpty(brand.getBrandName())) {
            stringBuffer.append("品牌名称(brandName)不能为空！").append(lineSeparator);
        }
    		
    		return stringBuffer.toString();
    }
    
    public static String validateUpdateBrandParams(Brand brand) {
		StringBuffer stringBuffer = new StringBuffer();
		
		if (StringUtils.isEmpty(brand.getBrandID())) {
	        stringBuffer.append("品牌ID(brandID)不能为空！").append(lineSeparator);
	    }
		
		if (StringUtils.isEmpty(brand.getBrandName())) {
	        stringBuffer.append("品牌名称(brandName)不能为空！").append(lineSeparator);
	    }
			
		return stringBuffer.toString();
	}
    
    public static String validateBrandIDParams(String brandID) {
		StringBuffer stringBuffer = new StringBuffer();
		
		if (StringUtils.isEmpty(brandID)) {
	        stringBuffer.append("品牌ID(brandID)不能为空！").append(lineSeparator);
	    }
		
		return stringBuffer.toString();
	}
    
    

}
